﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ext.Net;
using Sharp.Portal;
using Sharp.Portal.ExtNet;
using Sharp.Portal.Mvc;
using Sharp.Portal.Mvc.Form;

namespace Sharp.WebBooter.Areas.Demo.Models
{
    public class ControlModel : ISharpForm
    {
        public ControlModel()
        {
            UI = new ExtSharpFrom(this);
        }

        public SharpFrom UI { get; set; }

        /// <summary>
        /// 普通文本框
        /// </summary>
        [Display(Name = "普通文本框", Order = 0), DataType(DataType.Text)]
        public string Text { get; set; }

        /// <summary>
        /// 多行文本框
        /// </summary>
        [Display(Name = "多行文本框", Order = 5), DataType(DataType.MultilineText)]
        public string MultilineText { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        [Display(Name = "手机", Order = 0), DataType(DataType.PhoneNumber)]
        public string Phone { get; set; }

        /// <summary>
        /// 日期
        /// </summary>
        [Display(Name = "日期", Order = 2), DataType(DataType.DateTime)]
        //[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        public DateTime DateA { get; set; }

        /// <summary>
        /// 电子邮件
        /// </summary>
        [Display(Name = "电子邮件"), DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        /// <summary>
        /// Html
        /// </summary>
        [Display(Name = "Html"), DataType(DataType.Html)]
        public string Html { get; set; }

        /// <summary>
        /// 货币
        /// </summary>
        [Display(Name = "货币"), DataType(DataType.Currency)]
        public string Currency { get; set; }


        /// <summary>
        /// ImageUrl
        /// </summary>
        [Display(Name = "图片"), DataType(DataType.ImageUrl)]
        public string ImageUrl { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [Display(Name = "性别"), MasterData("Gender")]
        public string GenderCode { get; set; }


        [Display(Name = "归属部门", Order = 5), CustomField(FieldType.OrgTreeList, nameof(OrgIdDataSource))]
        public Guid? OrgId { get; set; }
        /// <summary>
        /// 所属组织
        /// </summary>
        public Node OrgIdDataSource { get; set; }

        [Display(Name = "外键选取框"), CustomField(FieldType.SelectBox, "/Demo/Default/RenderWindow/", DisplayField = "", ValueField = nameof(SelectBoxValue))]
        public string SelectBox { get; set; }
        [HiddenInput]
        public string SelectBoxValue { get; set; }
    }
}